package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppSystemLog;
import com.ep.modules.app.service.AppSystemLogService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/system_log")
public class AppSystemLogController {
    @Autowired
    private AppSystemLogService appSystemLogService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appSystemLogService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppSystemLog appsystemlog = appSystemLogService.getById(id);
        return R.ok().put("appsystemlog", appsystemlog);
    }

    @SysLog("保存AppSystemLog")
    @PostMapping("/save")
    public R save(@RequestBody AppSystemLog appsystemlog) {
        ValidatorUtils.validateEntity(appsystemlog);
        appSystemLogService.save(appsystemlog);
        return R.ok();
    }

    @SysLog("修改AppSystemLog")
    @PostMapping("/update")
    public R update(@RequestBody AppSystemLog appsystemlog) {
        ValidatorUtils.validateEntity(appsystemlog);
        appSystemLogService.update(appsystemlog);
        return R.ok();
    }

    @SysLog("删除AppSystemLog")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appSystemLogService.deleteBatch(ids);
        return R.ok();
    }
}